﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class Products : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadGrid();
        }

        private void LoadGrid()
        {
            using (var db = new NrthwndDataContext())
            {
                GridView1.DataSource = db.Products.Select(p => new { p.ProductName, p.UnitPrice, p.Category.CategoryName });
                GridView1.DataBind();
            }
        }
    }
}